package com.home.security.browser.auth.conrtoller;

import com.home.base.core.framework.msg.ServerResponse;
import com.home.common.constants.shiro.ShiroConstant;
import com.home.security.browser.auth.service.AuthService;
import com.home.security.browser.shiro.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Description:
 * Created by 王大宸 on 2020-11-14 11:35
 * Created with IntelliJ IDEA.
 */
@Controller
@RequestMapping(value = "/auth")
public class AuthController {
    @Autowired
    private AuthService authService;

    /***
     * 功能说明：退出登录
     *
     * @author 王大宸
     * @date 2020/11/14 11:36
     * @param
     * @return com.home.common.framework.msg.ServerResponse<java.lang.String>
     */
    @GetMapping(value = "/logout")
    @ResponseBody
    public ServerResponse<String> logout() {
        // 记录退出日志
        //  onlineService.removeOnline();
        ShiroUtils.logout();
        return ServerResponse.okData(ShiroConstant.LOGIN_URL);
    }

}
